package com.jysz.certificate.persistence.dao.mf;

import org.hibernate.SQLQuery;
import org.springframework.stereotype.Repository;

import com.jysz.certificate.persistence.dao.AbstractBaseDao;
import com.jysz.certificate.persistence.enums.mf.BillStatus;
import com.jysz.certificate.persistence.model.mf.Bill;

/**
 * 发票DAO
 * @author xuxiaolong
 */
@Repository
public class BillDao extends AbstractBaseDao<Bill, Long> {

	/**
	 * 更改整个申请单中的发票状态
	 * @param applyId
	 * @param status
	 */
	public void changeStatus(Long applyId,BillStatus status){
		String hql="UPDATE mf_bill_ bill SET bill._status=:status WHERE bill._bill_apply_id=:applyId";
		SQLQuery q=getSession().createSQLQuery(hql);
		q.setInteger("status", status.getIndex());
		q.setLong("applyId", applyId);
		q.executeUpdate();
	}
}
